/* Top Phones — tech store (RTL + LTR, light/dark) */

:root {
  --tp-primary: #0a1628;
  --tp-accent: #00e5a0;
  --tp-bg: #050a12;
  --tp-surface: #0d2137;
  --tp-surface2: #122a45;
  --tp-text: #f0f4f8;
  --tp-muted: #8ba3b8;
  --tp-border: rgba(0, 229, 160, 0.15);
  --tp-glow: rgba(0, 229, 160, 0.35);
  --tp-font-ar: "Cairo", system-ui, sans-serif;
  --tp-font-en: "Rajdhani", "Cairo", system-ui, sans-serif;
  --tp-radius: 14px;
  --tp-nav-h: 64px;
  --tp-topbar-h: 56px;
}

[data-theme="light"] {
  --tp-bg: #f4f7fb;
  --tp-surface: #ffffff;
  --tp-surface2: #e8eef5;
  --tp-text: #0a1628;
  --tp-muted: #5a6d7e;
  --tp-border: rgba(10, 22, 40, 0.12);
  --tp-glow: rgba(0, 120, 200, 0.2);
}

html[lang="en"] body {
  font-family: var(--tp-font-en);
}

html[lang="ar"] body {
  font-family: var(--tp-font-ar);
}

*, *::before, *::after { box-sizing: border-box; }

body.store-body {
  margin: 0;
  min-height: 100vh;
  background: var(--tp-bg);
  color: var(--tp-text);
  line-height: 1.5;
  padding-bottom: calc(var(--tp-nav-h) + env(safe-area-inset-bottom, 0));
}

.tp-bg-pattern {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
  background-image:
    linear-gradient(90deg, var(--tp-border) 1px, transparent 1px),
    linear-gradient(var(--tp-border) 1px, transparent 1px);
  background-size: 48px 48px;
  animation: tp-grid-drift 60s linear infinite;
}

@keyframes tp-grid-drift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 480px 240px, 480px 240px; }
}

.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: 16px;
  position: relative;
  z-index: 1;
}

.tp-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--tp-topbar-h);
  background: color-mix(in srgb, var(--tp-bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--tp-border);
}

.tp-topbar__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tp-topbar__controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tp-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--tp-border);
  background: var(--tp-surface);
  color: var(--tp-text);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.tp-icon-btn:hover {
  box-shadow: 0 0 20px var(--tp-glow);
  border-color: var(--tp-accent);
}

.tp-theme-toggle__sun { display: none; }
[data-theme="light"] .tp-theme-toggle__sun { display: inline; }
[data-theme="light"] .tp-theme-toggle__moon { display: none; }
[data-theme="dark"] .tp-theme-toggle__moon { display: inline; }
[data-theme="dark"] .tp-theme-toggle__sun { display: none; }

.tp-lang-switch {
  font-weight: 700;
  font-size: 0.85rem;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--tp-surface);
  border: 1px solid var(--tp-border);
  color: var(--tp-accent);
  text-decoration: none;
  transition: box-shadow 0.2s;
}
.tp-lang-switch:hover { box-shadow: 0 0 16px var(--tp-glow); }

.tp-logo {
  text-decoration: none;
  color: var(--tp-text);
  display: flex;
  align-items: center;
}
.tp-logo img { max-height: 36px; width: auto; object-fit: contain; }
.tp-logo__text {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--tp-text), var(--tp-accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tp-main { padding-block: 20px 24px; }

/* Hero */
.tp-hero {
  position: relative;
  border-radius: calc(var(--tp-radius) + 4px);
  overflow: hidden;
  margin-bottom: 28px;
  border: 1px solid var(--tp-border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
.tp-hero__track {
  display: flex;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.tp-hero__slide {
  min-width: 100%;
  position: relative;
  aspect-ratio: 16/7;
  max-height: 380px;
}
.tp-hero__slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tp-hero__caption {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  padding: 24px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
}
[data-theme="light"] .tp-hero__caption {
  background: linear-gradient(transparent, rgba(255, 255, 255, 0.92));
}
.tp-hero__caption h2 {
  margin: 0 0 8px;
  font-size: clamp(1.25rem, 4vw, 2rem);
}
.tp-hero__caption p { margin: 0; color: var(--tp-muted); }
.tp-hero__dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 12px;
  background: var(--tp-surface);
}
.tp-hero__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tp-muted);
  border: none;
  cursor: pointer;
  opacity: 0.5;
}
.tp-hero__dot.is-active {
  opacity: 1;
  background: var(--tp-accent);
  box-shadow: 0 0 10px var(--tp-glow);
}

/* Section */
.tp-section {
  margin-bottom: 32px;
}
.tp-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.tp-section__head h2 {
  margin: 0;
  font-size: 1.25rem;
}
.tp-link {
  color: var(--tp-accent);
  text-decoration: none;
  font-weight: 600;
}
.tp-link:hover { text-decoration: underline; }

/* Product grid */
.tp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
@media (min-width: 768px) {
  .tp-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

.tp-card {
  background: var(--tp-surface);
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s;
}
.tp-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px var(--tp-glow);
  border-color: color-mix(in srgb, var(--tp-accent) 50%, transparent);
}
.tp-card__img-wrap {
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--tp-surface2);
}
.tp-card__img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}
.tp-card:hover .tp-card__img-wrap img { transform: scale(1.06); }
.tp-card__body { padding: 12px 14px 14px; }
.tp-card__brand {
  font-size: 0.75rem;
  color: var(--tp-accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.tp-card__title {
  margin: 4px 0 8px;
  font-size: 0.95rem;
  font-weight: 700;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tp-card__price {
  font-weight: 800;
  font-size: 1.05rem;
}
.tp-card__compare {
  font-size: 0.8rem;
  color: var(--tp-muted);
  text-decoration: line-through;
  margin-inline-start: 8px;
}
.tp-deal-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  background: color-mix(in srgb, var(--tp-accent) 25%, transparent);
  color: var(--tp-accent);
}

/* Trust row */
.tp-trust {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 640px) {
  .tp-trust { grid-template-columns: repeat(3, 1fr); }
}
.tp-trust__item {
  padding: 16px;
  border-radius: var(--tp-radius);
  border: 1px solid var(--tp-border);
  background: var(--tp-surface);
  text-align: center;
}
.tp-trust__item strong { display: block; margin-bottom: 4px; color: var(--tp-accent); }

/* Brands */
.tp-brands {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.tp-brand-pill {
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--tp-surface2);
  border: 1px solid var(--tp-border);
  font-weight: 600;
  text-decoration: none;
  color: var(--tp-text);
  transition: box-shadow 0.2s;
}
.tp-brand-pill:hover {
  box-shadow: 0 0 16px var(--tp-glow);
  border-color: var(--tp-accent);
}

/* Filters bar */
.tp-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  align-items: flex-end;
}
.tp-filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--tp-muted);
}
.tp-input, .tp-select, .tp-textarea {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--tp-border);
  background: var(--tp-surface);
  color: var(--tp-text);
  font: inherit;
  min-width: 120px;
}
.tp-textarea { min-height: 100px; width: 100%; resize: vertical; }
.tp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 12px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.2s;
}
.tp-btn:active { transform: scale(0.98); }
.tp-btn--primary {
  background: linear-gradient(135deg, var(--tp-accent), color-mix(in srgb, var(--tp-accent) 60%, #0066aa));
  color: #021018;
}
.tp-btn--primary:hover { box-shadow: 0 0 24px var(--tp-glow); }
.tp-btn--ghost {
  background: transparent;
  border: 1px solid var(--tp-border);
  color: var(--tp-text);
}
.tp-btn--danger {
  background: #c62828;
  color: #fff;
}

/* Product detail */
.tp-pd {
  display: grid;
  gap: 24px;
}
@media (min-width: 900px) {
  .tp-pd { grid-template-columns: 1fr 1fr; align-items: start; }
}
.tp-pd__gallery {
  border-radius: var(--tp-radius);
  overflow: hidden;
  border: 1px solid var(--tp-border);
  background: var(--tp-surface);
}
.tp-pd__main-img {
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--tp-surface2);
}
.tp-pd__main-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s;
}
.tp-pd__main-img:hover img { transform: scale(1.04); }
.tp-pd__thumbs {
  display: flex;
  gap: 8px;
  padding: 10px;
  flex-wrap: wrap;
}
.tp-pd__thumbs button {
  width: 56px;
  height: 56px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  background: var(--tp-surface2);
}
.tp-pd__thumbs button.is-active { border-color: var(--tp-accent); }
.tp-pd__thumbs img { width: 100%; height: 100%; object-fit: cover; }

/* Cart table */
.tp-cart-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--tp-surface);
  border-radius: var(--tp-radius);
  overflow: hidden;
  border: 1px solid var(--tp-border);
}
.tp-cart-table th, .tp-cart-table td {
  padding: 12px;
  text-align: start;
  border-bottom: 1px solid var(--tp-border);
}
.tp-cart-table tr:last-child td { border-bottom: none; }

/* Bottom nav */
.tp-bottom-nav {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  height: calc(var(--tp-nav-h) + env(safe-area-inset-bottom, 0));
  padding-bottom: env(safe-area-inset-bottom, 0);
  background: color-mix(in srgb, var(--tp-bg) 92%, transparent);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--tp-border);
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  padding-top: 8px;
  z-index: 100;
}
.tp-bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.65rem;
  color: var(--tp-muted);
  text-decoration: none;
  position: relative;
  max-width: 80px;
}
.tp-bottom-nav__item.is-active { color: var(--tp-accent); }
.tp-bottom-nav__icon { font-size: 1.25rem; line-height: 1; }
.tp-bottom-nav__item--cart .tp-badge {
  position: absolute;
  top: -4px;
  inset-inline-end: 8px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--tp-accent);
  color: #021018;
  font-size: 0.65rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}

/* Auth card */
.tp-auth {
  max-width: 420px;
  margin: 24px auto;
  padding: 24px;
  border-radius: var(--tp-radius);
  border: 1px solid var(--tp-border);
  background: var(--tp-surface);
  animation: tp-fade-up 0.4s ease;
}
@keyframes tp-fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
.tp-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.tp-tabs button {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--tp-border);
  background: var(--tp-surface2);
  color: var(--tp-muted);
  font-weight: 700;
  cursor: pointer;
}
.tp-tabs button.is-active {
  background: var(--tp-accent);
  color: #021018;
  border-color: transparent;
}
.tp-form-row { margin-bottom: 14px; }
.tp-form-row label { display: block; margin-bottom: 6px; font-size: 0.85rem; color: var(--tp-muted); }

/* Admin */
body.admin-body {
  margin: 0;
  min-height: 100vh;
  background: var(--tp-bg);
  color: var(--tp-text);
  font-family: var(--tp-font-ar);
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0));
}
html[lang="en"] body.admin-body { font-family: var(--tp-font-en); }

.admin-shell { display: flex; min-height: 100vh; }
@media (min-width: 900px) {
  .admin-shell { padding-bottom: 0; }
  body.admin-body { padding-bottom: 0; }
}
.admin-sidebar {
  display: none;
  width: 240px;
  flex-shrink: 0;
  background: var(--tp-surface);
  border-inline-end: 1px solid var(--tp-border);
  padding: 20px 12px;
}
@media (min-width: 900px) {
  .admin-sidebar { display: block; }
}
.admin-sidebar a {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--tp-text);
  text-decoration: none;
  margin-bottom: 4px;
}
.admin-sidebar a:hover, .admin-sidebar a.is-active {
  background: var(--tp-surface2);
  color: var(--tp-accent);
}
.admin-main { flex: 1; padding: 20px 16px 100px; max-width: 1100px; }
.admin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.admin-stat {
  padding: 16px;
  border-radius: var(--tp-radius);
  background: var(--tp-surface);
  border: 1px solid var(--tp-border);
}
.admin-stat strong { display: block; font-size: 1.4rem; color: var(--tp-accent); }
.admin-table-wrap {
  overflow-x: auto;
  border-radius: var(--tp-radius);
  border: 1px solid var(--tp-border);
  background: var(--tp-surface);
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.admin-table th, .admin-table td {
  padding: 10px 12px;
  text-align: start;
  border-bottom: 1px solid var(--tp-border);
}
.admin-table th { color: var(--tp-muted); font-weight: 600; }
.admin-bottom-nav {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  display: flex;
  justify-content: space-around;
  background: color-mix(in srgb, var(--tp-bg) 94%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--tp-border);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom, 0));
  z-index: 100;
}
@media (min-width: 900px) {
  .admin-bottom-nav { display: none; }
}
.admin-bottom-nav a {
  flex: 1;
  text-align: center;
  font-size: 0.65rem;
  color: var(--tp-muted);
  text-decoration: none;
  max-width: 72px;
}
.admin-bottom-nav a.is-active { color: var(--tp-accent); }
.admin-bottom-nav span { display: block; font-size: 1.1rem; }

.tp-alert {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  border: 1px solid var(--tp-border);
}
.tp-alert--ok { background: color-mix(in srgb, var(--tp-accent) 15%, transparent); }
.tp-alert--err { background: rgba(198, 40, 40, 0.2); }

/* Utilities */
.tp-muted { color: var(--tp-muted); }
.tp-mb-0 { margin-bottom: 0; }
